/**
*      author: Y_Yao
*      created: 2024-10-14 10:33:09
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
priority_queue<int,vector<int>,greater<int>> small_heap;
priority_queue<int,vector<int>,less<int>> big_heap;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n = 0;
    cin >> n;
    int in = 0;
    cin >> in;
    int mid = in;
    cout << mid << endl;

    for(int i = 2;i <= n;i++)
    {
        cin >> in;
        if(in < mid)
        {
            big_heap.push(in);
        }
        else if(in >= mid)
        {
            small_heap.push(in);
        }

        if(i % 2 == 1)
        {
            while(small_heap.size() != big_heap.size())
            {
                if(small_heap.size() > big_heap.size())
                {
                    big_heap.push(mid);
                    mid = small_heap.top();
                    small_heap.pop();
                }
                else
                {
                    small_heap.push(mid);
                    mid = big_heap.top();
                    big_heap.pop();
                }
            }
            cout << mid << endl;
        }
    }
    return 0;
}